﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Threading;

namespace C7
{
	/// <summary>
	/// Interaction logic for MenuModule.xaml
	/// </summary>
    public partial class MessageWindow : UserControl
    {
        private WindowOperations WindowOPs = new WindowOperations();
        public MessageWindow()
        {
            this.InitializeComponent();
            WindowOPs.WindowToAnimationHandlers(LayoutRoot, true);
        }

        #region HeaderProperty
        public string Header
        {
            get { return (string)GetValue(HeaderProperty); }
            set { SetValue(HeaderProperty, value); }
        }

        public static readonly DependencyProperty HeaderProperty =
                                                DependencyProperty.Register(
                                                                            "Header",
                                                                            typeof(string),
                                                                            typeof(MessageWindow),
                                                                            new FrameworkPropertyMetadata(
                                                                            new PropertyChangedCallback(ChangeHeader)));

        private static void ChangeHeader(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            (source as MessageWindow).UpdateHeader((e.NewValue as string));
        }

        private void UpdateHeader(string newHeader)
        {
            tbTitle.Text = newHeader;
        }
        #endregion

        #region ContentsProperty
        public string Contents
        {
            get { return (string)GetValue(ContentsProperty); }
            set { SetValue(ContentsProperty, value); }
        }

        public static readonly DependencyProperty ContentsProperty =
                                                DependencyProperty.Register(
                                                                            "Contents",
                                                                            typeof(string),
                                                                            typeof(MessageWindow),
                                                                            new FrameworkPropertyMetadata(
                                                                            new PropertyChangedCallback(ChangeContents)));

        private static void ChangeContents(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            (source as MessageWindow).UpdateContents((e.NewValue as string));
        }

        private void UpdateContents(string newContents)
        {
            tbContent.Text = newContents;
        }
        #endregion
    }
}